1. Field of the Invention
The present invention relates to an image processing device, an image processing method, and a storage medium, and, more particularly, to an image processing device for extracting a motion area and a still area from an image (a moving image), and an image processing method and a storage medium for the image processing device.
2. Description of the Related Art
A conventional image processing device for extracting a moving object from a moving image detects a motion vector for each pixel using block matching from successively input several frames, and corrects the motion vector using neighboring motion vectors in space in alignment with the motion vector. The motion vector subsequent to the correction is assessed by performing block matching for the motion vector. Based on the score resulting from the assessment, the motion vector is recursively corrected to result in a highly reliable motion vector. A moving object is thus extracted based on the finally obtained motion vector.
For instance, such an image processing device sets up an 8xc3x978 pixel block in connection with a pixel of interest, and performs block matching using the block. Specifically, the image processing device calculates the sum of squared differences, each difference between the value of each pixel in a block including a pixel of interest and the value of a corresponding pixel in a block of an adjacent frame, namely, a prediction error, and determines a block of an adjacent frame that results in a minimum prediction error (hereinafter referred to as a minimum prediction error block). The motion vector of the pixel of interest is thus determined from the positional relationship between the block of the pixel of interest and the minimum prediction error block.
All pixels in a frame of interest are successively treated as a pixel of interest to determine the motion vector, and the motion vector of each pixel is thus corrected.
Focusing one pixel, the motion vector thereof is corrected using the weight corresponding to a prediction error (a prediction error obtained when the motion vector is determined) of the motion vector of a pixel in space close to the pixel of interest. The prediction error of the motion vector subsequent to the correction is calculated using the block of the pixel of interest and the block in an adjacent frame in a position shifted from the position of the first block by a distance corresponding to the corrected motion vector. The prediction error is used to assess the motion vector subsequent to the correction, while being used as a weight for the correction of the motion vector at the same time.
The correction of the motion vector is recursively performed on all pixels in an frame of interest until the sum of the prediction errors of the motion vectors of the pixels converges.
Accordingly, it is an object of the present invention to provide an image processing device free from the above problem.
An image processing device for calculating the motion direction of each pixel in a predetermined screen of interest from among a plurality of time series screens, includes a score calculator unit for calculating a score corresponding to each of a plurality of motion directions of each pixel in the predetermined screen of interest, based on pixels present in the motion direction across the plurality of the time series screens, and a motion direction calculator unit for calculating the motion direction of each pixel in the predetermined screen of interest, by processing the plurality of the motion directions based on the scores corresponding to the plurality of the motion directions.